﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NTTDATA.BEENChina.CaseMonitor.UI
{
    public partial class FormMonitorQuery : Form
    {
        public FormMonitorQuery()
        {
            InitializeComponent();
        }

        private void buttonSearch_Click(object sender, EventArgs e)
        {
            Search();
        }

        private void Search()
        {
            DataSet dataSet = DAO.CaseDBAccesser.GetMonitorRecords("processLog", this.dateTimePickerFrom.Value,
                                                 this.dateTimePickerTo.Value);
            if (dataSet != null)
            {
                this.dataGridViewMonitorRecords.DataSource = dataSet.Tables[0];

            }


        }

        private void SearchA()
        {
           /* DataSet dataSet = DAO.CaseDBAccesser.GetMonitorRecords("processLog", this.dateTimePickerFrom.Value,
                                                 this.dateTimePickerTo.Value);
            if (dataSet != null)
            {
                int RowCount = dataSet.Tables[0].Rows.Count;　　　　//总记录


                listViewMonitor.Items.Clear();
                
                //循环每一行
                for (int i = 0; i < RowCount; i++)
                {
                    string itemName = dataSet.Tables[0].Rows[i][0].ToString();

                    ListViewItem item = new ListViewItem() ;
                    item.Name = itemName;
                    item.Text = itemName;

                    //循环每一列
                    for (int j = 1; j < 3; j++)
                    {
                        string itemText = dataSet.Tables[0].Rows[i][j].ToString();

                        

                        if (j == 2 && itemText.EndsWith("call Tel ."))
                        {
                            itemText = itemText.Replace("call Tel .", "");

                            item.SubItems.Add(itemText);
                            item.SubItems.Add("●");
                        }
                        else
                        {
                            item.SubItems.Add(itemText);
                        }

                    } 
                    

                    //将整理好的item加入到listview
                    listViewMonitor.Items.Add(item); 
                }

            }*/

          
        }
    }
}
